(function(){
    var complain_obj = {};

    //用户投诉
    complain_obj.submit = function(){                  
        $("#btn_sub").live('tap',function(event){
            cmp_uid = $('#cmp_uid').val();            
            if(cmp_uid==''){
                alert('请传入被投诉的用户ID');
                return false;                
            }
            record_id = $('#record_id').val();
            if(record_id==''){
                alert('请传入被投诉的记录ID');
                return false;              
            }
            reason = $("input[name='reason']:checked").val();
            if(reason==''){
                alert('请选择投诉理由');
                return false;                                      
            }  
            param={};         
            param.h =$('#h').val();  
            param.record_id = record_id ;
            param.cmp_uid = cmp_uid ;
            param.reason = reason ;
            document.location = "tcxqt://submit::type::200";         
            $.getJSON(config.url_base + "/handle.php", param, function(data){
                if(!data.state){
                    //请求数据失败
                    document.location = "tcxqt://submit::type::" + 202;
                    return false;
                }
                if(data.msg){
                    alert(data.msg);
                    return false;                                            
                } 
                document.location = "tcxqt://submit::type::" + 201;
            });

        })
    }







    //请求得到商家信息
    if(window.complain_obj == undefined){
        window.complain_obj =complain_obj;
    }
})();

